#include <iostream>
#include <climits>
using namespace std;

// 97.63 %
class Solution
{
  public:
	int reverse(int x)
	{
		int sign = x > 0 ? 1 : 0;
		long long res = 0;
		x = x < 0 ? -x : x;
		while (x)
		{
			res = res * 10 + x % 10;
			x /= 10;
		}
		if (sign == 0)
			res = -res;
		if (res < INT_MIN || res > INT_MAX)
		{
			return 0;
		}
		return res;
	}
};

int main()
{
	int x = 1534236469;
	cout << Solution().reverse(x) << endl;
	return 0;
}
